package net.sxnic.ugr.role.action;

import java.util.List;

import net.sxnic.ugr.UgrActionSupport;
import net.sxnic.ugr.group.Group;
import net.sxnic.ugr.group.GroupManager;
import net.sxnic.ugr.role.Role;
import net.sxnic.ugr.user.User;
import net.sxnic.ugr.user.UserManager;

import org.springframework.beans.factory.annotation.Autowired;
/**
 * 
 * Introduction：
 * @author 孙宇飞
 * create date : 2010-5-16
 */
@SuppressWarnings("serial")
public class BrowseUserGroupsInRole extends UgrActionSupport {

    private List<User> users;

    private List<Group> groups;

    @Autowired
    private UserManager userManager;

    @Autowired
    private GroupManager groupManager;

    public String execute() throws Exception {
        checkRoles(Role.SYSTEM_ADMIN);

        groups = groupManager.getAll();

        return SUCCESS;
    }

    /**
     * @return the users
     */
    public List<User> getUsers() {
        return users;
    }

    /**
     * @return the groups
     */
    public List<Group> getGroups() {
        return groups;
    }
}
